<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
function &func_class_load($classname, $filename = '') {
	if( $filename == '' ) {
		$filename = $classname;
	}
	$classfile = CONFIG_PATH . CONFIG_DIR_CLASSES . '' . strtolower($filename) . '.class.php';
	if( file_exists($classfile) ) {
		include_once($classfile);
		$obj = new $classname;
		
		return $obj;
	}
	
	return false;
}

//create class object
function &func_class_createobject($classname) {
	if( class_exists($classname) ) {
		return new $classname();
	} else {
		die("CO " . $classname);
	}
	
	return NULL;
}
//
?>